<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
		<title>IP定位</title>
		<script type="text/javascript"
			src="http://api.map.baidu.com/api?v=1.3"></script>
	</head>
	<body>
		<div style="width: 520px; height: 340px; border: 1px solid gray"
			id="container"></div>
	</body>
</html>
<script type="text/javascript">
var map = new BMap.Map("container");            // 创建Map实例
var point = new BMap.Point(116.404, 39.915);    // 创建点坐标
map.centerAndZoom(point,15);

function myFun(result){
    var cityName = result.name;
    map.setCenter(cityName);
}
var myCity = new BMap.LocalCity();
myCity.get(myFun);
</script>